
<%@page import="java.sql.ResultSet"%>
<%@page import="Model.ReviewManager"%>
<%@page import="Model.Review"%>
<%@page import="Model.UserManager"%>
<%
    try {
        Review newRev = new Review();
        newRev.setReviewContent(request.getParameter("rev"));
        newRev.setReviewerID(new UserManager().getAccountIDFromUser(session.getAttribute("username").toString()));
        newRev.setReviewProductID(request.getParameter("pr"));

        boolean res = new ReviewManager().AddReview(newRev);

        if (res == true) {
            ResultSet revList = new ReviewManager().getReviews(newRev.getReviewProductID());

            %>
<ul style="padding-left: 125px; list-style-type: none; text-align: left;">
<%
            while (revList.next()) {%> 
            <li><div class="comment"><%=revList.getString("ReviewContent")%><br/>
                    <span style="font-size: 10px; margin-left: 450px;">by:<%=revList.getString("Username")%>, <%=revList.getString("DateReview")%> <%=revList.getString("TimeReview")%></span></div></li>
<% }%>
</ul>

<%       }
    } catch (Exception e) {
        e.printStackTrace();
    }
%>